home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 128 9 / q09.d81 / t.ss player < prev    next >
Text File  |  2022-08-28  |  5KB  |  109 lines

  1.  
  2.             ZERO PAGE: USING SONGSMITH SONGS IN YOUR BASIC PROGRAMS
  3.  
  4.                        by Fender Tucker and Jon Mattson
  5.  
  6.      Let's face it, the standard music format for the C-64 and C-128
  7. computers is Craig Chamberlain's SID format from Compute!'s Gazette.  It's
  8. been around for years and his editor's capabilities are amazing.  There are
  9. only two things that detract from SID format's dominance of the music field
  10. and they are:
  11.  
  12.      (1) The editor takes quite a while to master, and
  13.  
  14.      (2) LOADSTAR's SONGSMITH.
  15.  
  16.      SONGSMITH, by Joe Garrett, is a songmaking program published by
  17. Softdisk that makes transcribing music from sheet music very easy.  It also
  18. appeals to the traditional musician because it uses standard musical
  19. notation rather than a computer-oriented format, as SID does.  We've been
  20. pushing SONGSMITH for several years, and thanks to Jon Mattson, we now have
  21. a simple, elegant way for SONGSMITH songs to be used in the C-128 mode.
  22.  
  23.      The magic is in the file "128 player.o" which will be found on all
  24. LOADSTAR 128 disks from now on.  All you have to do is BLOAD the player and
  25. two music files and wonderful melodies are but a SYS away.  Why don't I list
  26. the few lines of BASIC code that will accomplish everything and explain each
  27. one?
  28.  
  29. 100 bload"128 player.o",b0,p6050  :rem load player
  30. 110 bload"m.music",b0,p30720      :rem load music data
  31. 120 bload"w.music"                :rem load instrument data
  32. 130 sys6050,0,0,120               :rem play music
  33. 140 getkeya$                      :rem get s, r or b
  34. 150 ifa$="s"thensys6053:goto140   :rem stop music
  35. 160 ifa$="r"thensys6056:goto140   :rem resume music
  36. 170 ifa$="b"then130               :rem begin music from start
  37.  
  38.      You must load the player code before you do anything else.  Just stick
  39. line 100 near the beginning of your program.
  40.  
  41.      SONGSMITH creates five different files for each song.  The files you
  42. need to copy onto your program disk are the ones that start with "m." and
  43. "w.".  The other three are for SONGSMITH's use only.  The "m." file can be
  44. placed anywhere in memory that's safe.  Where's "safe"?  That depends on
  45. what the rest of your program does.  When you use ML routines, it's
  46. important to know where they reside in memory and what other parts of memory
  47. they affect.  LOADSTAR 128's menu program puts the music data at 30720 (or
  48. 120*256).  The "w." file is always saved by SONGSMITH at the same address
  49. and must be loaded into that same address.  Just use the syntax in line 120
  50. and it'll be put in the right place.
  51.  
  52.      Now everything's in memory and all you need to do is tell the program
  53. whether you want to start a song, stop a song, or resume a song where it was
  54. stopped.  Line 130 starts a song.  The syntax is:
  55.  
  56.      SYS6050,bank (0 or 1),low byte, high byte
  57.  
  58. 30720 is equal to 120*256 with 0 left over.  This means that 120 is the high
  59. byte and 0 is the low byte.  If we had used 40000 in line 110 rather than
  60. 30720, we would have 156 as the high byte and 64 as the low byte, since
  61. 40000 is equal to 156*256 with 64 left over.  You can see that the commands
  62. in lines 110 and 130 are dependent upon each other.
  63.  
  64.      Presumably your program will have user input and line 140 simulates
  65. that. If the user presses "s", then line 150 will stop the music.  If he
  66. presses "r" the music will resume from where it was stopped.  If he presses
  67. "b" the music will start from the beginning by recalling the initial play
  68. command.
  69.  
  70.      So, in a nutshell,
  71.  
  72.           sys6050,b,l,h   starts music
  73.  
  74.           sys6053         stops music
  75.  
  76.           sys6056         resumes music
  77.  
  78. What could be simpler?
  79.  
  80.      What if you wanted to have the music stop at a certain point, say, at
  81. the end of the first verse?  Easy.  The current measure is found in memory
  82. location 6059.  Use a line like this to stop a song at measure 17.
  83.  
  84.      180 ifpeek(6059)=17thensys6053
  85.  
  86. How do you know that the first verse ends at measure 17?  Write a little
  87. program such as the one above and change this line.
  88.  
  89.      140 geta$:?[home]"peek(6059):ifa$=""then140
  90.  
  91. As the song plays the measure it's on will be displayed in the upper left
  92. corner of the screen.  Just remember the number that's displayed when the
  93. first verse ends.
  94.  
  95.      Memory location 6059 will contain a 255 when the song is over, even if
  96. there are fewer measures in the song.  SONGSMITH doesn't allow over 255
  97. measures per song.
  98.  
  99.      The only snags in using "128 player.o" in your programs will be due to
  100. memory or interrupt conflicts.  If it doesn't work, try loading the music
  101. somewhere else.  If you're using another interrupt-driven routine in your
  102. program, good luck and happy troubleshooting.  Jon uses a lot of routines in
  103. the new LOADSTAR 128 presenter and gets them all to work simultaneously. 
  104. That's why I asked him to create the new system -- I knew he could do it.
  105.  
  106. FT
  107.                              **** End of Text ****
  108.                                                                             
  109.